home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Graphics / include / tuple_2d.h < prev    next >
Encoding:
Text File  |  1995-03-25  |  2.8 KB  |  52 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    tuple_2d.h
  3. //    Date:                    1/21/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a 2d tuple_3d
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include "coord.h"
  11.  
  12. #ifndef    TUPLE_2D
  13. #define    TUPLE_2D
  14.  
  15. //------------------------------------------------------------------------------
  16. //    classes
  17. //------------------------------------------------------------------------------
  18. class    tuple_2d                                                                                                                                    //    2 dimensional tuple_2d class
  19. {                                                                                                                                                                //    begin tuple_2d class definition
  20.     private:                                                                                                                                            //    members internal to this class only
  21.     protected:                                                                                                                                        //    members internal to this class hierarchy
  22.                 real    xy[2];                                                                                                                        //    2 tuple_2d
  23.     public:                                                                                                                                                //    members available externally
  24.                 tuple_2d (void) {}                                                                                                            //    default constructor
  25.                 tuple_2d (const tuple_2d &t);                                                                                        //    copy constructor
  26.                 tuple_2d (real x, real y);                                                                                            //    constructor from 2 values
  27.                 void    operator = (const tuple_2d &t);                                                                        //    assignment operator
  28.                 bool    operator == (const tuple_2d &t) const;                                                        //    equality operator
  29.                 bool    operator != (const tuple_2d &t) const;                                                        //    inequality operator
  30.                 void    operator () (real x, real y);                                                                            //    function call operator
  31.                 real    operator | (const tuple_2d &t) const;                                                            //    inner product operator
  32.                 real    operator [] (coord c) const;                                                                            //    array reference operator
  33.                 real    &operator [] (coord c);                                                                                        //    array reference operator
  34. };                                                                                                                                                            //    end tuple_2d class definition
  35.  
  36. //------------------------------------------------------------------------------
  37. //    inlines
  38. //------------------------------------------------------------------------------
  39. inline    real    tuple_2d::operator [] (coord c) const                                                            //    array reference operator
  40. {                                                                                                                                                                //    begin
  41.     return xy[c];                                                                                                                                    //    return the appropriate coordinate of the tuple_2d
  42. }                                                                                                                                                                //    end
  43.  
  44. //------------------------------------------------------------------------------
  45. inline    real    &tuple_2d::operator [] (coord c)                                                                    //    array reference operator
  46. {                                                                                                                                                                //    begin
  47.     return xy[c];                                                                                                                                    //    return the appropriate coordinate of the tuple_2d
  48. }                                                                                                                                                                //    end
  49.  
  50. //------------------------------------------------------------------------------
  51.  
  52. #endif    //TUPLE_2D